<template>
    <div class="table">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-menu"></i>{{$route.name}}
                </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div>
            <div class="handle-box">
                <el-form ref="form" :model="form" label-width="200px">
                    <el-form-item label="局域网餐车定位文件URL:">
                        <el-input v-model="form.fileUrl" style="width:50%"></el-input>
                    </el-form-item>
                    <el-form-item label="点餐时间:">
                        <el-time-select placeholder="起始时间" v-model="form.startTime" :picker-options="{
      start: '00:00',
      step: '00:05',
      end: '24:00'
    }">
                        </el-time-select> ~
                        <el-time-select placeholder="结束时间" v-model="form.endTime" :picker-options="{
      start: '00:00',
      step: '00:05',
      end: '24:0',
      minTime: form.startTime
    }">
                        </el-time-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="info" @click="add">保存</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>
<script>
import { getOrderSetting, putOrderSetting } from '../../api/server.js'
export default {
    data() {
        return {
            form: {
                fileUrl: '',
                startTime: '',
                endTime: ''
            }
        }
    },
    created() {
        this.getSetting()
    },
    methods: {
        getSetting() {
            getOrderSetting()
                .then(res => {
                    this.form.fileUrl = res.result.file_url
                    this.form.startTime = res.result.start_time
                    this.form.endTime = res.result.end_time
                })
        },
        add() {
            let form = this.form
            putOrderSetting(form)
                .then(res => {
                    this.$message.success('修改成功')
                })
        }
    }
}
</script>
<style lang="scss" scoped>
.handle-box {
  margin-bottom: 1%;
  .search {
    width: 30%;
  }
}

.block {
  text-align: center;
  margin-top: 1%;
}
</style>